﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace HistoryToMail
{
    public partial class LogsForm : Form
    {
        public LogsForm()
        {
            InitializeComponent();
        }

        public void AddLog(String text)
        {
            if (textBox1.InvokeRequired)
            {
                SetTextCallback d = new SetTextCallback(setText);
                this.Invoke(d, new object[] { text });
            }
            else
            {
                setText(text);
            }
        }

        private delegate void SetTextCallback(String data);



        private void setText(String msg)
        {
            textBox1.Text += msg;
            if (msg.Length > 0 && msg[msg.Length - 1] != '\n')
            {
                textBox1.Text += "\r\n";
            }
        }


    }
}
